package com.zlp.spring.aop.proxy;

import com.zlp.spring.aop.service.Pen;
import sun.misc.ProxyGenerator;
import java.io.FileOutputStream;
import java.io.IOException;

public class ProxyTest {

    public static void main(String[] args) {
        byte[] bytes = ProxyGenerator.generateProxyClass("$proxy", new Class[]{Pen.class});
        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream("D:\\project\\code\\spring-study-example\\spring-aop\\target\\classes\\$proxyPen.class");
            fos.write(bytes);
            fos.flush();
            fos.close();
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            try {
                if (fos != null) {
                    fos.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
